package com.xiaobias;

import java.io.IOException;
import java.nio.channels.Selector;

public abstract class ServerThread extends Thread {

    protected Selector selector;

    public ServerThread(String name) {
        super(name);
        try {
            this.selector = Selector.open();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    protected void closeSelector() {
        try {
            this.selector.close();;
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    protected void wakeupSelector() {
        this.selector.wakeup();
    }
}
